package com.rmd.ai.grpc.service;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: book.proto")
public final class RmdBookAiServiceGrpc {

  private RmdBookAiServiceGrpc() {}

  public static final String SERVICE_NAME = "com.rmd.ai.grpc.service.RmdBookAiService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getSearchMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Book.RmdBookRequest,
      com.rmd.ai.grpc.service.Book.RmdBookResponse> METHOD_SEARCH = getSearchMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Book.RmdBookRequest,
      com.rmd.ai.grpc.service.Book.RmdBookResponse> getSearchMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Book.RmdBookRequest,
      com.rmd.ai.grpc.service.Book.RmdBookResponse> getSearchMethod() {
    return getSearchMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Book.RmdBookRequest,
      com.rmd.ai.grpc.service.Book.RmdBookResponse> getSearchMethodHelper() {
    io.grpc.MethodDescriptor<com.rmd.ai.grpc.service.Book.RmdBookRequest, com.rmd.ai.grpc.service.Book.RmdBookResponse> getSearchMethod;
    if ((getSearchMethod = RmdBookAiServiceGrpc.getSearchMethod) == null) {
      synchronized (RmdBookAiServiceGrpc.class) {
        if ((getSearchMethod = RmdBookAiServiceGrpc.getSearchMethod) == null) {
          RmdBookAiServiceGrpc.getSearchMethod = getSearchMethod = 
              io.grpc.MethodDescriptor.<com.rmd.ai.grpc.service.Book.RmdBookRequest, com.rmd.ai.grpc.service.Book.RmdBookResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(
                  "com.rmd.ai.grpc.service.RmdBookAiService", "Search"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.rmd.ai.grpc.service.Book.RmdBookRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.rmd.ai.grpc.service.Book.RmdBookResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new RmdBookAiServiceMethodDescriptorSupplier("Search"))
                  .build();
          }
        }
     }
     return getSearchMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static RmdBookAiServiceStub newStub(io.grpc.Channel channel) {
    return new RmdBookAiServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static RmdBookAiServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new RmdBookAiServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static RmdBookAiServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new RmdBookAiServiceFutureStub(channel);
  }

  /**
   */
  public static abstract class RmdBookAiServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Book.RmdBookRequest> search(
        io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Book.RmdBookResponse> responseObserver) {
      return asyncUnimplementedStreamingCall(getSearchMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getSearchMethodHelper(),
            asyncBidiStreamingCall(
              new MethodHandlers<
                com.rmd.ai.grpc.service.Book.RmdBookRequest,
                com.rmd.ai.grpc.service.Book.RmdBookResponse>(
                  this, METHODID_SEARCH)))
          .build();
    }
  }

  /**
   */
  public static final class RmdBookAiServiceStub extends io.grpc.stub.AbstractStub<RmdBookAiServiceStub> {
    private RmdBookAiServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdBookAiServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdBookAiServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdBookAiServiceStub(channel, callOptions);
    }

    /**
     */
    public io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Book.RmdBookRequest> search(
        io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Book.RmdBookResponse> responseObserver) {
      return asyncBidiStreamingCall(
          getChannel().newCall(getSearchMethodHelper(), getCallOptions()), responseObserver);
    }
  }

  /**
   */
  public static final class RmdBookAiServiceBlockingStub extends io.grpc.stub.AbstractStub<RmdBookAiServiceBlockingStub> {
    private RmdBookAiServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdBookAiServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdBookAiServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdBookAiServiceBlockingStub(channel, callOptions);
    }
  }

  /**
   */
  public static final class RmdBookAiServiceFutureStub extends io.grpc.stub.AbstractStub<RmdBookAiServiceFutureStub> {
    private RmdBookAiServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private RmdBookAiServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RmdBookAiServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new RmdBookAiServiceFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_SEARCH = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final RmdBookAiServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(RmdBookAiServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_SEARCH:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.search(
              (io.grpc.stub.StreamObserver<com.rmd.ai.grpc.service.Book.RmdBookResponse>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class RmdBookAiServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    RmdBookAiServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.rmd.ai.grpc.service.Book.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("RmdBookAiService");
    }
  }

  private static final class RmdBookAiServiceFileDescriptorSupplier
      extends RmdBookAiServiceBaseDescriptorSupplier {
    RmdBookAiServiceFileDescriptorSupplier() {}
  }

  private static final class RmdBookAiServiceMethodDescriptorSupplier
      extends RmdBookAiServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    RmdBookAiServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (RmdBookAiServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RmdBookAiServiceFileDescriptorSupplier())
              .addMethod(getSearchMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
